<template>
  <view style="display: flex;flex-direction: column;max-height: 100%;">
    <view class="uni-header">
      <view class="uni-group">
        <!-- 显示标题 -->
        <view class="uni-title">图标（uni-icons）</view>
        <view class="uni-sub-title">点击选择图标</view>
        <!-- 显示描述 -->
      </view>
    </view>
    <view style="flex:1;overflow: hidden;flex-shrink: 0;" >
      <scroll-view scroll-y style="height: calc(100vh - 85px)" show-scrollbar>
        <view class="uni-container">
          <view class="icons">
            <view v-for="(icon,index) in icons" :key="index" class="icon-item pointer"
              @click="selectIcon('uni-icons-' + icon)">
              <view :class="'uni-icons-'+icon"></view>
              <text class="icon-text">uni-icons-{{icon}}</text>
            </view>
          </view>
        </view>
      </scroll-view>
    </view>
  </view>
</template>

<script>
  import icons from './uni-icons.js'

  export default {
    data() {
      return {
        icons,
        height: 0,
      }
    },
    methods: {
      selectIcon(value) {
        this.$emit("selectIcon", value);
      }
    }
  }
</script>


<style lang="scss">
  .icons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .icon-item {
    display: flex;
    width: 16.6%;
    height: 120px;
    font-size: 30px;
    text-align: center;
    justify-content: center;
    align-items: center;
    flex-direction: column;
  }

  .icon-item:hover,
  .icon-item:hover .icon-text {
    color: $uni-color-primary;
  }

  .icon-text {
    color: #99a9bf;
    font-size: 12px;
    text-align: center;
    height: 1em;
    line-height: 1em;
    margin-top: 15px;
  }

  /* #ifdef H5 */
  @media only screen and (max-width: 500px) {
    .icon-item {
      width: 33.3%;
    }
  }

  /* #endif */
</style>